@import "tailwindcss";

/* 全局样式 */
html,
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
  background-color: #ffffff;
}

#root {
  min-height: 100vh;
  transition: background-color 0.3s ease;
  background-color: #ffffff;
}

/* 自定义动画 */
@keyframes fadeIn {
  0% {
    opacity: 0;
    transform: translateY(-10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

@keyframes scaleIn {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@layer utilities {
  .animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
  }
  
  .animate-slide-up {
    animation: slideUp 0.6s ease-out forwards;
    opacity: 0;
  }

  .animate-pulse-custom {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  }

  .animate-bounce-custom {
    animation: bounce 1s ease-in-out infinite;
  }

  .animate-shimmer {
    animation: shimmer 2s linear infinite;
    background: linear-gradient(
      to right,
      transparent 0%,
      rgba(255, 255, 255, 0.3) 50%,
      transparent 100%
    );
    background-size: 1000px 100%;
  }

  .animate-scale-in {
    animation: scaleIn 0.5s ease-out forwards;
  }
  
  /* 自定义滚动条样式 */
  .scrollbar-thin {
    scrollbar-width: thin;
  }
  
  .scrollbar-thin::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }
  
  .scrollbar-thin::-webkit-scrollbar-track {
    background: rgba(148, 163, 184, 0.1);
    border-radius: 4px;
  }
  
  .scrollbar-thin::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.4);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
  }
  
  .scrollbar-thin::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.6);
    background-clip: padding-box;
  }
  
  /* 针对深色背景的滚动条（左侧菜单） */
  .scrollbar-dark::-webkit-scrollbar-track {
    background: rgba(30, 41, 59, 0.3);
  }
  
  .scrollbar-dark::-webkit-scrollbar-thumb {
    background: rgba(71, 85, 105, 0.6);
  }
  
  .scrollbar-dark::-webkit-scrollbar-thumb:hover {
    background: rgba(71, 85, 105, 0.8);
  }
}

/* 深色模式样式 */
.dark {
  color-scheme: dark;
}

/* 确保 html 和 body 在深色模式下有正确的背景 */
.dark,
.dark html,
.dark body {
  background-color: #111827 !important;
  color: #f3f4f6;
}

/* 确保根容器在深色模式下有正确的背景 */
.dark #root {
  background-color: #111827;
  min-height: 100vh;
}

/* 深色模式下的卡片和背景 */
.dark .bg-white {
  background-color: #1f2937;
}

.dark .bg-white\/80 {
  background-color: rgba(31, 41, 55, 0.8);
}

.dark .bg-white\/50 {
  background-color: rgba(31, 41, 55, 0.5);
}

/* 深色模式下的渐变背景 */
.dark .bg-gradient-to-br {
  background-image: linear-gradient(to bottom right, var(--tw-gradient-stops));
}

.dark .from-gray-50,
.dark .from-gray-50\/50 {
  --tw-gradient-from: #1f2937 var(--tw-gradient-from-position);
  --tw-gradient-to: transparent var(--tw-gradient-to-position);
  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}

.dark .via-white,
.dark .via-white\/50 {
  --tw-gradient-to: transparent var(--tw-gradient-to-position);
  --tw-gradient-stops: var(--tw-gradient-from), #1f2937 var(--tw-gradient-via-position), var(--tw-gradient-to);
}

.dark .to-gray-50,
.dark .to-gray-50\/50 {
  --tw-gradient-to: #1f2937 var(--tw-gradient-to-position);
}

/* 深色模式下的文本颜色 */
.dark .text-gray-800,
.dark .text-gray-900 {
  color: #f3f4f6;
}

.dark .text-gray-600,
.dark .text-gray-700 {
  color: #d1d5db;
}

.dark .text-gray-500 {
  color: #9ca3af;
}

.dark .text-gray-400 {
  color: #9ca3af;
}

/* 深色模式下的边框颜色 */
.dark .border-gray-200,
.dark .border-gray-300 {
  border-color: #374151;
}

.dark .border-gray-100 {
  border-color: #4b5563;
}

.dark .border-gray-200\/50,
.dark .border-gray-300\/50 {
  border-color: rgba(55, 65, 81, 0.5);
}

/* 深色模式下的输入框 */
.dark input,
.dark textarea,
.dark select {
  background-color: #1f2937;
  color: #f3f4f6;
  border-color: #374151;
}

.dark input::placeholder,
.dark textarea::placeholder {
  color: #9ca3af;
}

/* 深色模式下的滚动条 */
.dark .scrollbar-thin::-webkit-scrollbar-track {
  background: rgba(31, 41, 55, 0.3);
}

.dark .scrollbar-thin::-webkit-scrollbar-thumb {
  background: rgba(75, 85, 99, 0.6);
}

.dark .scrollbar-thin::-webkit-scrollbar-thumb:hover {
  background: rgba(75, 85, 99, 0.8);
}

/* 文档表格主题适配 */
.document-table-light .ant-table-container,
.document-table-light .ant-table-content,
.document-table-light .ant-table-tbody > tr > td,
.document-table-light .ant-table-thead > tr > th {
  background-color: #f8fafc !important;
}

.document-table-light .ant-table-thead > tr > th {
  color: #1e293b !important;
}

.document-table-light .ant-table-tbody > tr:hover > td {
  background-color: rgba(59, 130, 246, 0.1) !important;
}

.document-table-dark .ant-table,
.document-table-dark .ant-table-container,
.document-table-dark .ant-table-content,
.document-table-dark .ant-table-tbody > tr > td,
.document-table-dark .ant-table-thead > tr > th {
  background-color: rgba(15, 23, 42, 0.75) !important;
  color: #e2e8f0 !important;
  border-color: rgba(148, 163, 184, 0.12) !important;
}

.document-table-dark .ant-table-thead > tr > th {
  background-color: rgba(15, 23, 42, 0.85) !important;
  color: #f8fafc !important;
}

.document-table-dark .ant-table-tbody > tr:hover > td {
  background-color: rgba(59, 130, 246, 0.18) !important;
}

.document-table-dark .ant-table-placeholder,
.document-table-dark .ant-empty-description {
  color: #94a3b8 !important;
}

/* 商品列表表格主题 */
.product-table-light .ant-table-thead > tr > th {
  background-color: #f8fafc !important;
  color: #1e293b !important;
}

.product-table-light .ant-table-tbody > tr > td {
  background-color: #ffffff !important;
}

.product-table-light .ant-table-tbody > tr:hover > td {
  background-color: rgba(59, 130, 246, 0.08) !important;
}

.product-table-dark .ant-table,
.product-table-dark .ant-table-container,
.product-table-dark .ant-table-content,
.product-table-dark .ant-table-tbody > tr > td,
.product-table-dark .ant-table-thead > tr > th {
  background-color: rgba(15, 23, 42, 0.88) !important;
  color: #e2e8f0 !important;
  border-color: rgba(148, 163, 184, 0.12) !important;
}

.product-table-dark .ant-table-thead > tr > th {
  background-color: rgba(15, 23, 42, 0.95) !important;
  color: #f8fafc !important;
}

.product-table-dark .ant-table-tbody > tr > td {
  background-color: rgba(15, 23, 42, 0.85) !important;
}

.product-table-dark .ant-table-tbody > tr.product-row-dark-even > td {
  background-color: rgba(15, 23, 42, 0.82) !important;
}

.product-table-dark .ant-table-tbody > tr.product-row-dark-odd > td {
  background-color: rgba(15, 23, 42, 0.88) !important;
}

.product-table-dark .ant-table-tbody > tr:hover > td {
  background-color: rgba(59, 130, 246, 0.22) !important;
}

.product-table-dark .ant-pagination-item,
.product-table-dark .ant-pagination-prev,
.product-table-dark .ant-pagination-next {
  background-color: rgba(15, 23, 42, 0.88) !important;
  border-color: rgba(148, 163, 184, 0.24) !important;
}

.product-table-dark .ant-pagination-item a,
.product-table-dark .ant-pagination-prev button,
.product-table-dark .ant-pagination-next button {
  color: #cbd5f5 !important;
}

.product-table-dark .ant-pagination-item-active {
  border-color: #3b82f6 !important;
}

.product-table-dark .ant-pagination-item-active a {
  color: #3b82f6 !important;
}

.dark-ant-btn {
  background-color: rgba(15, 23, 42, 0.85) !important;
  border-color: rgba(51, 65, 85, 0.6) !important;
  color: #cbd5f5 !important;
}

.dark-ant-btn:hover,
.dark-ant-btn:focus {
  background-color: rgba(30, 41, 59, 0.88) !important;
  border-color: rgba(59, 130, 246, 0.55) !important;
  color: #e2e8f0 !important;
}

.dark-ant-btn-primary {
  background-color: #2563eb !important;
  border-color: #2563eb !important;
  color: #ffffff !important;
}

.dark-ant-btn-primary:hover,
.dark-ant-btn-primary:focus {
  background-color: #1d4ed8 !important;
  border-color: #1d4ed8 !important;
  color: #ffffff !important;
}

.product-filter-input.ant-input {
  background-color: #ffffff;
}

.product-filter-input-dark.ant-input {
  background-color: rgba(15, 23, 42, 0.92) !important;
  border-color: rgba(71, 85, 105, 0.8) !important;
  color: #e2e8f0 !important;
}

.product-filter-input-dark.ant-input::placeholder {
  color: rgba(148, 163, 184, 0.8) !important;
}

.product-filter-input-dark.ant-input:hover,
.product-filter-input-dark.ant-input:focus {
  border-color: #3b82f6 !important;
  box-shadow: none !important;
}

.dark-ant-dropdown .ant-dropdown-menu {
  background-color: rgba(15, 23, 42, 0.92) !important;
  border: 1px solid rgba(51, 65, 85, 0.6) !important;
}

.dark-ant-dropdown .ant-dropdown-menu-item,
.dark-ant-dropdown .ant-dropdown-menu-submenu-title {
  color: #e2e8f0 !important;
}

.dark-ant-dropdown .ant-dropdown-menu-item:hover,
.dark-ant-dropdown .ant-dropdown-menu-item-active,
.dark-ant-dropdown .ant-dropdown-menu-submenu-title:hover {
  background-color: rgba(59, 130, 246, 0.22) !important;
  color: #ffffff !important;
}